@extends('common.layouts')
@section('content')
    @include('common.message')
    @include('common.validator')
    <!-- 自定义内容区域 -->
    <div class="panel panel-default">
        <div class="panel-heading">修改id为{{$student->id}}学生</div>
        <div class="panel-body">
            <form class="form-horizontal" method="post" action="{{route('student.update',$student)}}">
                @csrf
                <input name="_method" type="hidden" value="PUT">
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label">姓名</label>

                    <div class="col-sm-5">
                        <input type="text" class="form-control" name="Student[name]"
                               value="{{old('Student.name') ? old('Student.name') : $student->name}}"
                               placeholder="请输入学生姓名">
                    </div>
                    <div class="col-sm-5">
                        <p class="form-control-static text-danger">{{$errors->first('Student.name')}}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label for="age" class="col-sm-2 control-label">年龄</label>

                    <div class="col-sm-5">
                        <input type="text" value="{{old('Student.age') ? old('Student.age') : $student->age}}"
                               class="form-control" name="Student[age]" placeholder="请输入学生年龄">
                    </div>
                    <div class="col-sm-5">
                        <p class="form-control-static text-danger">{{$errors->first('Student.age')}}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label for="age" class="col-sm-2 control-label">邮箱</label>

                    <div class="col-sm-5">
                        <input type="text" class="form-control" value="{{old('Student.email') ? old('Student.email') : $student->email}}"
                               name="Student[email]" placeholder="请输入学生邮箱">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">性别</label>

                    <div class="col-sm-5">
                        @foreach($student->sex() as $ind=>$val)
                            <label class="radio-inline">
                                <input type="radio" name="Student[sex]" value="{{$ind}}" {{$student->sex == $ind ?'checked':''}}> {{$val}}
                            </label>
                        @endforeach
                    </div>
                    <div class="col-sm-5">
                        <p class="form-control-static text-danger">{{$errors->first('Student.sex')}}</p>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

@endsection